package com.mzw.mzwinterface.controller;

import com.mzw.mzwclientsdk.model.Word;
import com.yupi.yucongming.dev.client.YuCongMingClient;
import com.yupi.yucongming.dev.common.BaseResponse;
import com.yupi.yucongming.dev.model.DevChatRequest;
import com.yupi.yucongming.dev.model.DevChatResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author L1nAn
 */
@RestController
@RequestMapping("/word")
@Slf4j
public class WordController {

    @Resource
    private YuCongMingClient yuCongMingClient;
    @PostMapping("/translation")
    public String getWordTranslation(@RequestBody Word word) {
        DevChatRequest devChatRequest = new DevChatRequest();
        devChatRequest.setModelId(1695075931053367298L);
        devChatRequest.setMessage("给我翻译下面这个单词：" + word + "的中文意思");
        BaseResponse<DevChatResponse> response = yuCongMingClient.doChat(devChatRequest);
        return response.getData().getContent();
    }
}
